package com.spc.service;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.spc.bean.Bis_wechat_record;
import com.spc.mapper.Bis_wechat_recordMapper;
import com.xbw.bean.Sys_User;

@Service
@Transactional
public class Bis_wechat_recordServicelmpl implements Bis_wechat_recordService{

	@Autowired
	HttpSession Session;
	
	@Autowired
	private Bis_wechat_recordMapper bis_wechat_recordMapper;

	@Transactional(propagation=Propagation.SUPPORTS)
	@Override
	public List<Bis_wechat_record> listAll(Map map) {
		// TODO Auto-generated method stub
		Sys_User user = (Sys_User) Session.getAttribute("sysuser");
		map.put("user_id", user.getUser_id());
		return this.bis_wechat_recordMapper.listAll(map);
	}

	@Transactional(propagation=Propagation.REQUIRED)
	@Override
	public void delete(String ids) {
		// TODO Auto-generated method stub
		String[] array=ids.split(",");
		for(String id:array){
			System.out.println(id);
			this.bis_wechat_recordMapper.delete(id);
		}
	}
	
	@Transactional(propagation=Propagation.REQUIRED)
	@Override
	public void save(Bis_wechat_record bis_wechat_record) {
		// TODO Auto-generated method stub
		Sys_User user = (Sys_User) Session.getAttribute("sysuser");
		bis_wechat_record.setCreate_user_id(user.getUser_id());
		this.bis_wechat_recordMapper.save(bis_wechat_record);
	}
}
